<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <form method="post" class="js-ajax-form" action="{:url('AdminCategory/listorders')}">
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="16">
                </th>
                <th>职位名称</th>
                <th>职位描述</th>
            </tr>
            </thead>
            <tbody>
            <volist name="lists" id="vo">
                <tr class="data-item-tr">
                    <td>
                        <input type="radio" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="id"
                               value="{$vo.id}" data-name="{$vo.name}" <eq name="vo.id" value="$id">checked</eq> >
                    </td>
                    <td>{$vo.name}</td>
                    <td>{$vo.remark}</td>
                </tr>
            </volist>
            </tbody>
        </table>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $('.data-item-tr').click(function (e) {

        console.log(e);
        var $this = $(this);
        if ($(e.target).is('input')) {
            return;
        }

        var $input = $this.find('input');
        if ($input.is(':checked')) {
            $input.prop('checked', false);
        } else {
            $input.prop('checked', true);
        }
    });

    function confirm() {
        var selectedCategoriesId   = [];
        var selectedCategoriesName = [];
        var selectedCategories     = [];
        $('.js-check:checked').each(function () {
            var $this = $(this);
            selectedCategoriesId.push($this.val());
            selectedCategoriesName.push($this.data('name'));

            selectedCategories.push({
                id: $this.val(),
                name: $this.data('name')
            });
        });

        return {
            selectedCategories: selectedCategories,
            selectedCategoriesId: selectedCategoriesId,
            selectedCategoriesName: selectedCategoriesName
        };
    }
</script>
</body>
</html>